﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Krile.Kernel.Bridges;

namespace Krile.Kernel.Control.Surface
{
    public class ChainMouseEventArgs : MouseEventArgs
    {
        public ChainMouseEventArgs()
            : base(MouseButtons.None, 0, 0, 0, 0)
        {
            parent = null;
            _throwsub = false;
        }

        private ChainMouseEventArgs(IForm parent, MouseButtons mbs, int clicks, int x, int y, int delta) :
            base(mbs, clicks, x, y, delta)
        {
            this.parent = parent;
            _throwsub = false;
        }

        public static ChainMouseEventArgs Factory(IForm parent, MouseEventArgs ev)
        {
            return new ChainMouseEventArgs(parent, ev.Button, ev.Clicks, ev.X, ev.Y, ev.Delta);
        }

        private IForm parent;
        public IForm ParentForm { get { return parent; } }


        /// <summary>
        /// サブメソッドへチェーンを渡すように設定します。
        /// </summary>
        public void SetThrowSub()
        {
            _throwsub = true;
        }

        /// <summary>
        /// 現在呼び出されているメソッドでチェーンが終了するように設定します。
        /// </summary>
        public void SetTerminate()
        {
            _throwsub = false;
        }

        private bool _throwsub;
        public bool IsThrowedSub { get { return _throwsub; } }
    }
}
